package Demo6;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-05-15
 * Time: 22:45
 */
public class Test {
    public void Demo1(Test1 test1){
        //......
    }
    public Test2 Demo2(){
        Test2 test2 = new Test2();
        return test2;
    }
    public static void main(String[] args) {
        //三种向上转移方法
//        1.直接赋值
        Test1 test1 = new Test2();
        Test t = new Test();
//        test1.test1();
//        test1.test2();编译没通过
//        2.通过形参赋值
//        t.Demo1(test1);
//        3.通过放回值赋值
        Test1 g = t.Demo2();
    }
}
